package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    @AutoFill(OperationType.UPDATE)
    Integer countByCategoryId(Long id);


    @AutoFill(OperationType.INSERT)
    int saveSetmeal(Setmeal setmeal);

    List<SetmealVO> querySetmealList(Setmeal setmeal);

    @AutoFill(OperationType.UPDATE)
    int updateStatus(Setmeal setmeal);

    SetmealVO querySetmealById(Long id);

    @AutoFill(OperationType.UPDATE)
    int updateSetmeal(Setmeal setmeal);

    int deleteSetmealByIds(List<Long> ids);

    int countStatus(Integer status, List<Long> ids);

    Long queryCategoryIdByid(Long id);

    /**
     * 根据条件统计套餐数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);

}
